package com.gitee.melin.bee.core.jdbc.enums;

import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.gitee.melin.bee.core.enums.BaseStringEnum;
import com.gitee.melin.bee.core.enums.jackson.JacksonEnumStringSerializer;

/**
 * 数据类型
 */
@JsonSerialize(using = JacksonEnumStringSerializer.class)
public enum DataSourceType implements BaseStringEnum {
    HIVE("Hive", "org.apache.hive.jdbc.HiveDriver"),
    IMPALA("Impala", "org.apache.hive.jdbc.HiveDriver"),
    INCEPTOR("Inceptor", "org.apache.hive.jdbc.HiveDriver"), // 星环 Inceptor
    MYSQL("MySQL", "com.mysql.cj.jdbc.Driver"),
    TIDB("TiDB", "com.mysql.cj.jdbc.Driver"),
    DORIS("Doris", "com.mysql.cj.jdbc.Driver"),
    STARROCKS("StarRocks", "com.mysql.cj.jdbc.Driver"),
    POSTGRESQL("PostgreSQL", "org.postgresql.Driver"),
    DB2("DB2", "com.ibm.db2.jcc.DB2Driver"),
    SQLSERVER("SQLServer", "com.microsoft.sqlserver.jdbc.SQLServerDriver"),
    ORACLE("Oracle", "oracle.jdbc.driver.OracleDriver"),
    GAUSS("Gauss", "org.postgresql.Driver"),
    GREENPLUM("Greenplum", "org.postgresql.Driver"),
    HANA("Hana", "com.sap.db.jdbc.Driver"),
    PHOENIX("Phoenix", "org.apache.phoenix.jdbc.PhoenixDriver"),
    DAMENG("DaMeng", "dm.jdbc.driver.DmDriver"),
    OCEANBASE("OceanBase", "com.alipay.oceanbase.jdbc.Driver"),
    MAXCOMPUTE("MaxCompute", "com.aliyun.odps.jdbc.OdpsDriver"),
    CLICKHOUSE("ClickHouse", "com.clickhouse.jdbc.ClickHouseDriver"),
    REDSHIFT("Redshift", "com.amazon.redshift.jdbc42.Driver"),
    CASSANDRA("Cassandra", "com.simba.cassandra.jdbc42.Driver");

    private String name;

    private String driverClass;

    DataSourceType(String name) {
        this.name = name;
    }

    DataSourceType(String name, String driverClass) {
        this.name = name;
        this.driverClass = driverClass;
    }

    @JsonValue
    @Override
    public String getValue() {
        return this.name;
    }

    @Override
    public String toString() {
        return this.getValue();
    }

    public String getDriverClass() {
        return driverClass;
    }
}
